local que_yaojiu = fk.CreateSkill {
    name = "que_yaojiu",
    anim_type = "drawcard",
    tags = { Skill.Compulsory }
}
Fk:loadTranslationTable {
    ["que_yaojiu"] = "幺九",
    [":que_yaojiu"] = "锁定技，准备阶段，你可以从牌堆或弃牌堆中获得点数A和点数9的牌各一张；通过〖幺九〗和〖奇运〗获得的牌不计入手牌上限；" ..
        "出牌阶段结束时，若你区域内点数A和点数9的牌不小于13张，令其他角色失去体力至1点，然后弃置这些牌。",

    ["@@que_yao-inhand"] = "幺",
    ["@@que_jiu-inhand"] = "九",
}
que_yaojiu:addEffect(fk.EventPhaseStart, {
    anim_type = "support",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(que_yaojiu.name) and player.phase == Player.Start and
            #table.filter(table.connect(player.room.draw_pile, player.room.discard_pile), function(id)
                return Fk:getCardById(id).number == 1 or Fk:getCardById(id).number == 9
            end) > 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local card1 = room:getCardsFromPileByRule(".|1")
        if #card1 > 0 then
            room:moveCardTo(card1, Player.Hand, player, fk.ReasonPrey, que_yaojiu.name, nil, false, player,
                "@@que_yao-inhand")
        end
        local card2 = room:getCardsFromPileByRule(".|9")
        if #card2 > 0 then
            room:moveCardTo(card2, Player.Hand, player, fk.ReasonPrey, que_yaojiu.name, nil, false, player,
                "@@que_jiu-inhand")
        end
    end,
})
que_yaojiu:addEffect("maxcards", {
    exclude_from = function(self, player, card)
        return card:getMark("@@que_yao-inhand") ~= 0 or card:getMark("@@que_jiu-inhand") ~= 0
    end,
})
que_yaojiu:addEffect(fk.EventPhaseStart, {
    anim_type = "support",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(que_yaojiu.name) and player.phase == Player.Finish and
            (#table.filter(player:getCardIds("hej"), function(id)
                return Fk:getCardById(id).number == 1 or Fk:getCardById(id).number == 9
            end) + player:getMark("@que_qiyun")) > 12
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        for _, i in ipairs(room:getOtherPlayers(player)) do
            if not i.dead then
                room:loseHp(i, i.hp - 1, que_yaojiu.name)
            end
        end
        local cards = table.filter(player:getCardIds("hej"), function(id)
            return Fk:getCardById(id).number == 1 or Fk:getCardById(id).number == 9
        end)
        if #cards > 0 then
            room:throwCard(cards, que_yaojiu.name, player, player)
        end
        room:setPlayerMark(player, "@que_qiyun", 0)
    end,
})

return que_yaojiu
